{{- define "image_pull_secret" }}
{{- printf "{\"auths\": {\"%s\": {\"username\": \"%s\",\"password\": \"%s\", \"auth\": \"%s\"}}}" .Values.image_registry.addr .Values.image_registry.user .Values.image_registry.passwd (printf "%s:%s" .Values.image_registry.user .Values.image_registry.passwd | b64enc) | b64enc }}
{{- end }}

{{- define "images.skiff_ops_tools_images" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.skiff_ops_tools_images }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.skiff_ops_tools_images }}
{{- end -}}
{{- end }}

{{- define "images.platform_audit_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.platform_audit_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.platform_audit_image }}
{{- end -}}
{{- end }}

{{- define "images.platform_user_auth_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.platform_user_auth_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.platform_user_auth_image }}
{{- end -}}
{{- end }}

{{- define "images.skiff_adapter_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.skiff_adapter_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.skiff_adapter_image }}
{{- end -}}
{{- end }}


{{- define "images.front_nodejs_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_nodejs_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_nodejs_image }}
{{- end -}}
{{- end }}

{{- define "images.front_apigw_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_apigw_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_apigw_image }}
{{- end -}}
{{- end }}

{{- define "images.front_nsf_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_nsf_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_nsf_image }}
{{- end -}}
{{- end }}

{{- define "images.front_apm_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_apm_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_apm_image }}
{{- end -}}
{{- end }}

{{- define "images.front_cicd_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_cicd_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_cicd_image }}
{{- end -}}
{{- end }}

{{- define "images.front_ncs_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_ncs_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_ncs_image }}
{{- end -}}
{{- end }}

{{- define "images.front_gtxs_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_gtxs_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_gtxs_image }}
{{- end -}}
{{- end }}

{{- define "images.front_logseer_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_logseer_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_logseer_image }}
{{- end -}}
{{- end }}

{{- define "images.front_paas_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_paas_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_paas_image }}
{{- end -}}
{{- end }}

{{- define "images.front_platform_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_platform_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_platform_image }}
{{- end -}}
{{- end }}

{{- define "images.front_login_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_login_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_login_image }}
{{- end -}}
{{- end }}

{{- define "images.front_nos_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_nos_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_nos_image }}
{{- end -}}
{{- end }}

{{- define "images.front_hdm_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.front_hdm_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.front_hdm_image }}
{{- end -}}
{{- end }}

{{- define "replicas.platform_user_auth" }}
{{- if eq .Values.replica_semantic "ha" -}}
{{- print .Values.ha_replicas.platform_user_auth }}
{{- else if eq .Values.replica_semantic "poc" -}}
{{- print .Values.poc_replicas.platform_user_auth }}
{{- end -}}
{{- end }}

{{- define "replicas.platform_audit" }}
{{- if eq .Values.replica_semantic "ha" -}}
{{- print .Values.ha_replicas.platform_audit }}
{{- else if eq .Values.replica_semantic "poc" -}}
{{- print .Values.poc_replicas.platform_audit }}
{{- end -}}
{{- end }}

{{- define "replicas.front" }}
{{- if eq .Values.replica_semantic "ha" -}}
{{- print .Values.ha_replicas.front }}
{{- else if eq .Values.replica_semantic "poc" -}}
{{- print .Values.poc_replicas.front }}
{{- end -}}
{{- end }}
